package chap05;

/**
 * Created by root on 2017/7/7.
 */
class LinkQueue{
    private FirstLastList theList;
    public LinkQueue(){
        theList = new FirstLastList();
    }
    public boolean isEmpty(){
        return theList.isEmpty();
    }

    public void insert(long d){
        theList.insertLast(d);
    }

    public long remove(){
        return theList.deleteFirst().dData;
    }

    public void displayQueue(){
        System.out.print("Queue (front -- > rear)");
        theList.displayList();
    }
}
public class LinkQueueApp {
    public static void main(String[] args){
        LinkQueue theQueue = new LinkQueue();
        theQueue.insert(20);
        theQueue.insert(40);

        theQueue.displayQueue();

        theQueue.insert(60);
        theQueue.insert(80);

        theQueue.displayQueue();

        theQueue.remove();
        theQueue.remove();

        theQueue.displayQueue();
    }
}
